package com.test.fileupload;

import com.test.actionsupport.ActionSupport;
import lombok.Getter;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/9/13 21:34
 */
public class DownloadAction extends ActionSupport {
    private static final long serialVersionUID = 8675611693122127788L;

    @Getter
    private String contentTyep;

    @Getter
    private long contentLength;

    @Getter
    private String contentDisposition;

    @Getter
    private InputStream inputStream;

    @Override
    public String execute() throws Exception {

        //确定各个成员变量的值
        contentTyep = "text/html";
        contentDisposition = "attachment;filename=jprofiler_sn.txt";
        File file = new File("E:\\Download\\jprofiler_sn.txt");
        inputStream = new FileInputStream(file);
        contentLength = inputStream.available();

        return SUCCESS;
    }
}
